import { Client } from "./mod.ts";

/**
 * Media types
 */
export const MediaTypes = {
  /**
   * Application SHA media type
   */
  MediaApplicationSHA: "application/vnd.gogs.sha"
} as const;

/**
 * Options for rendering markdown
 */
export interface MarkdownOption {
  text: string;
  context?: string;
}

/**
 * Miscellaneous API endpoints
 */
export class MiscellaneousAPI {
  constructor(private client: Client) {}

  /**
   * Render markdown text
   */
  async renderMarkdown(options: MarkdownOption): Promise<string> {
    return await this.client.doRequest<string>(
      "POST", 
      "/markdown", 
      { "Content-Type": "application/json" },
      options
    );
  }

  /**
   * Render markdown text in raw mode
   */
  async renderMarkdownRaw(text: string): Promise<string> {
    return await this.client.doRequest<string>(
      "POST", 
      "/markdown/raw", 
      { "Content-Type": "text/plain" },
      text
    );
  }
}

/**
 * Helper function to create a pointer to a boolean value
 */
export function bool(v: boolean): boolean {
  return v;
}

/**
 * Helper function to create a pointer to a string value
 */
export function string(v: string): string {
  return v;
}

/**
 * Helper function to create a pointer to a number value
 */
export function number(v: number): number {
  return v;
} 